import request from '@/utils/request'

export function getCategoryListWithCache(query) {
  return request({
    url: `/api/business/categories_admin/`,
    method: 'get',
    params: query
  })
}

export function getCategoryList(query) {
  return request({
    url: `/api/business/categories_admin/`,
    method: 'get',
    params: query
  })
}

export function getCategory(id) {
  return request({
    url: `/api/business/categories_admin/${id}/`,
    method: 'get'
  })
}

export function createCategory(data) {
  return request({
    url: `/api/business/categories_admin/`,
    method: 'post',
    data
  })
}

export function updateCategory(id, data) {
  return request({
    url: `/api/business/categories_admin/${id}/`,
    method: 'put',
    data
  })
}

export function deleteCategory(id) {
  return request({
    url: `/api/business/categories_admin/${id}/`,
    method: 'delete'
  })
}

export function getCategorySelectList(query) {
  return request({
    url: `/api/business/categories/`,
    method: 'get',
    params: query
  })
}
